# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Orhun Parmaksız <orhunparmaksiz@gmail.com>
pkgname=gpg-tui
pkgver=0.10.0
pkgrel=0
pkgdesc="Terminal user interface for GnuPG"
url="https://github.com/orhun/gpg-tui"
license="MIT"
arch="all !s390x" # FTBFS
makedepends="cargo gpgme-dev libxcb-dev libxkbcommon-dev libgpg-error-dev cargo-auditable"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/orhun/gpg-tui/archive/v$pkgver/gpg-tui-$pkgver.tar.gz"

build() {
	cargo auditable build --release --locked

	mkdir completions
	OUT_DIR=completions cargo run --release --bin gpg-tui-completions
}

check() {
	cargo test --release --locked
}

package() {
	install -Dm755 target/release/$pkgname -t "$pkgdir"/usr/bin/

	install -Dm644 man/$pkgname.1 -t "$pkgdir"/usr/share/man/man1/

	install -Dm644 completions/$pkgname.bash "$pkgdir"/usr/share/bash-completion/completions/$pkgname
	install -Dm644 completions/$pkgname.fish "$pkgdir"/usr/share/fish/vendor_completions.d/$pkgname.fish
	install -Dm644 completions/_$pkgname "$pkgdir"/usr/share/zsh/site-functions/_$pkgname
}

sha512sums="
819481ed5f52c8092a8c711e642653955573250183a436278beb396d069c9734a1b3b1f077a7d7798f3f463c41c8a148bc72c26446bae391f5874705a6d35fe3  gpg-tui-0.10.0.tar.gz
"
